package com.easylinkin.sm.permission.jpa;

import javax.persistence.criteria.Path;
import org.springframework.data.jpa.domain.Specification;

import com.easylinkin.sm.permission.CustomerPermission;

/**
 * 客户权限
 *
 * <p>基于JPA实现
 *
 * @author TianGanLin
 * @since 1.0.0, 2019/10/16
 */
public interface JpaCustomerPermission extends CustomerPermission {

  @Override
  JpaCustomerPermission customer(Long id);

  @Override
  JpaCustomerPermission currentCustomer();

  /**
   * 设置业务表客户外键
   *
   * @param fieldName 客户属性名称
   */
  JpaCustomerPermission foreignKey(String fieldName);

  /**
   * 设置业务表客户外键
   *
   * @param path 客户属性
   */
  JpaCustomerPermission foreignKey(Path path);

  /**
   * 生成JPA查询条件
   *
   * @param <T> 实体类型
   * @return JPA查询条件
   */
  <T> Specification<T> specification();
}
